<?php
class OrderDoneController extends Controller{
	public function __construct($data) {
		parent::__construct($data);
	}

	public function index()
	{
		require_once( '../system/ecjp_m.php' );
		require_once( "../system/Class_M_DAO.php" );
	 $this->_load_php_file("chklogin.php");
	        if(!isset($_SESSION['USER'])){
	    	
	       require_once( '../system/cookie.php' );
	    
	        }
		$this->_load_php_file("Class_FUNC.php");
		$site = Class_FUNC::get_site();
	    if(isset($site['site_keyword']))
	    $this->assign('site_keyword', $site['site_keyword']);
        if(isset($site['site_description']))
	    $this->assign('site_description', $site['site_description']);
	    if(isset($site['site_title']))
	    $this->assign('site_title', '注文完了 | ご注文 | 買い物カゴ |'.$site['site_title']);
		
		$this->_load_mdao_class("t_m_goods");
	    $goods_dao = new t_m_goods;
		  //
	       $sql = "SELECT b.id,b.goods_name,b.goods_image,b.goods_unitprice FROM d_good_rank a inner JOIN d_goods b ON a.good_id = b.id ORDER BY a.rank";
	       $charts_data = $goods_dao->get_rows($sql);
	        foreach ($charts_data as &$value){
	          if(isset($value['goods_image']) && !empty($value['goods_image'])){
	     	     $value['goods_image'] = Class_FUNC::get_imagepath($value['id'],$value['goods_image'],101);
	       }
	         if(isset($value['goods_unitprice']) && !empty($value['goods_unitprice'])){
	          	 $value['goods_rate'] = $value['goods_unitprice']+$value['goods_unitprice'] * RATE;
	          }
	     }     
	       if (isset($charts_data))
	       $this->assign('charts_data',$charts_data);
	        
	       
	        //商品category
	       $sql = 'SELECT * FROM  m_categorygood';
           $category_data = $goods_dao->get_rows($sql);
           if (isset($category_data))
           $this->assign('category_data', $category_data);
	       
	       
	     $this->assign('categorying', $this->fetch('sp/categorying.html'));   
		
	    $this->assign('sp_meta', $this->fetch('sp/sp_meta.html'));  
	    $this->assign('chartsing', $this->fetch('sp/charts.html'));	    
	    $this->assign('sp_head', $this->fetch('sp/sp_head.html'));
        $this->assign('sp_foot', $this->fetch('sp/sp_foot.html'));
		$this->display('sp/order_done.html');
	}
}